/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('cloudcontrol', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CancelTaskResponseBody = {
  requestId?: string(name='requestId'),
}

model CancelTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CancelTaskResponseBody(name='body'),
}

async function cancelTask(taskId: string): CancelTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cancelTaskWithOptions(taskId, headers, runtime);
}

async function cancelTaskWithOptions(taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CancelTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CancelTask',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/tasks/${OpenApiUtil.getEncodeParam(taskId)}/operation/cancel`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model CreateResourceRequest {
  body?: string(name='body'),
  clientToken?: string(name='clientToken'),
  regionId?: string(name='regionId'),
}

model CreateResourceResponseBody = {
  requestId?: string(name='requestId'),
  resourceId?: string(name='resourceId'),
  taskId?: string(name='taskId'),
  timeout?: int32(name='timeout'),
}

model CreateResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateResourceResponseBody(name='body'),
}

async function createResource(provider: string, productCode: string, resourceTypeCode: string, request: CreateResourceRequest): CreateResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createResourceWithOptions(provider, productCode, resourceTypeCode, request, headers, runtime);
}

async function createResourceWithOptions(provider: string, productCode: string, resourceTypeCode: string, request: CreateResourceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateResourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    query['clientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = request.body,
  };
  var params = new OpenApi.Params{
    action = 'CreateResource',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}/resources`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model DeleteResourceRequest {
  clientToken?: string(name='clientToken'),
  regionId?: string(name='regionId'),
}

model DeleteResourceResponseBody = {
  requestId?: string(name='requestId'),
  taskId?: string(name='taskId'),
  timeout?: int32(name='timeout'),
}

model DeleteResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteResourceResponseBody(name='body'),
}

async function deleteResource(provider: string, productCode: string, resourceTypeCode: string, resourceId: string, request: DeleteResourceRequest): DeleteResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteResourceWithOptions(provider, productCode, resourceTypeCode, resourceId, request, headers, runtime);
}

async function deleteResourceWithOptions(provider: string, productCode: string, resourceTypeCode: string, resourceId: string, request: DeleteResourceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteResourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    query['clientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteResource',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}/resources/${OpenApiUtil.getEncodeParam(resourceId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model GetResourceRequest {
  regionId?: string(name='regionId'),
  resourceTypeVersion?: string(name='resourceTypeVersion'),
}

model GetResourceResponseBody = {
  requestId?: string(name='requestId'),
  resource?: {
    regionId?: string(name='regionId'),
    resourceAttributes?: string(name='resourceAttributes'),
    resourceId?: string(name='resourceId'),
  }(name='resource'),
}

model GetResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetResourceResponseBody(name='body'),
}

async function getResource(provider: string, productCode: string, resourceTypeCode: string, resourceId: string, request: GetResourceRequest): GetResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceWithOptions(provider, productCode, resourceTypeCode, resourceId, request, headers, runtime);
}

async function getResourceWithOptions(provider: string, productCode: string, resourceTypeCode: string, resourceId: string, request: GetResourceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceTypeVersion)) {
    query['resourceTypeVersion'] = request.resourceTypeVersion;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResource',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}/resources/${OpenApiUtil.getEncodeParam(resourceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model GetResourceTypeRequest {
  resourceTypeVersion?: string(name='resourceTypeVersion'),
}

model GetResourceTypeResponseBody = {
  requestId?: string(name='requestId'),
  resourceType?: {
    createOnlyProperties?: [ string ](name='createOnlyProperties'),
    deleteOnlyProperties?: [ string ](name='deleteOnlyProperties'),
    filterProperties?: [ string ](name='filterProperties'),
    getOnlyProperties?: [ string ](name='getOnlyProperties'),
    getResponseProperties?: [ string ](name='getResponseProperties'),
    handlers?: {
      create?: {
        permissions?: [ string ](name='permissions'),
      }(name='create'),
      delete?: {
        permissions?: [ string ](name='permissions'),
      }(name='delete'),
      get?: {
        permissions?: [ string ](name='permissions'),
      }(name='get'),
      list?: {
        permissions?: [ string ](name='permissions'),
      }(name='list'),
      update?: {
        permissions?: [ string ](name='permissions'),
      }(name='update'),
    }(name='handlers'),
    info?: {
      chargeType?: string(name='chargeType'),
      deliveryScope?: string(name='deliveryScope'),
      description?: string(name='description'),
      title?: string(name='title'),
    }(name='info'),
    listOnlyProperties?: [ string ](name='listOnlyProperties'),
    listResponseProperties?: [ string ](name='listResponseProperties'),
    primaryIdentifier?: string(name='primaryIdentifier'),
    product?: string(name='product'),
    properties?: map[string]any(name='properties'),
    publicProperties?: [ string ](name='publicProperties'),
    readOnlyProperties?: [ string ](name='readOnlyProperties'),
    required?: [ string ](name='required'),
    resourceType?: string(name='resourceType'),
    resourceTypeVersion?: string(name='resourceTypeVersion'),
    sensitiveInfoProperties?: [ string ](name='sensitiveInfoProperties'),
    updateOnlyProperties?: [ string ](name='updateOnlyProperties'),
    updateTypeProperties?: [ string ](name='updateTypeProperties'),
  }(name='resourceType'),
}

model GetResourceTypeResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetResourceTypeResponseBody(name='body'),
}

async function getResourceType(provider: string, productCode: string, resourceTypeCode: string, request: GetResourceTypeRequest): GetResourceTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getResourceTypeWithOptions(provider, productCode, resourceTypeCode, request, headers, runtime);
}

async function getResourceTypeWithOptions(provider: string, productCode: string, resourceTypeCode: string, request: GetResourceTypeRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetResourceTypeResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.resourceTypeVersion)) {
    query['resourceTypeVersion'] = request.resourceTypeVersion;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetResourceType',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model GetTaskResponseBody = {
  requestId?: string(name='requestId'),
  task?: {
    createTime?: string(name='createTime'),
    error?: {
      code?: string(name='code'),
      message?: string(name='message'),
    }(name='error'),
    product?: string(name='product'),
    regionId?: string(name='regionId'),
    resourceId?: string(name='resourceId'),
    resourceType?: string(name='resourceType'),
    status?: string(name='status'),
    taskAction?: string(name='taskAction'),
    taskId?: string(name='taskId'),
  }(name='task'),
}

model GetTaskResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTaskResponseBody(name='body'),
}

async function getTask(taskId: string): GetTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskWithOptions(taskId, headers, runtime);
}

async function getTaskWithOptions(taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTask',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/tasks/${OpenApiUtil.getEncodeParam(taskId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListDataSourcesRequest {
  filter?: map[string]any(name='filter'),
}

model ListDataSourcesShrinkRequest {
  filterShrink?: string(name='filter'),
}

model ListDataSourcesResponseBody = {
  dataSources?: [ 
    {
      dataSourceAttributes?: string(name='dataSourceAttributes'),
      id?: string(name='id'),
    }
  ](name='dataSources'),
  requestId?: string(name='requestId'),
}

model ListDataSourcesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListDataSourcesResponseBody(name='body'),
}

async function listDataSources(provider: string, productCode: string, resourceTypeCode: string, attributeName: string, request: ListDataSourcesRequest): ListDataSourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataSourcesWithOptions(provider, productCode, resourceTypeCode, attributeName, request, headers, runtime);
}

async function listDataSourcesWithOptions(provider: string, productCode: string, resourceTypeCode: string, attributeName: string, tmpReq: ListDataSourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataSourcesResponse {
  Util.validateModel(tmpReq);
  var request = new ListDataSourcesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'filter', 'json');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.filterShrink)) {
    query['filter'] = request.filterShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDataSources',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}/dataSources/${OpenApiUtil.getEncodeParam(attributeName)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListProductsRequest {
  maxResults?: long(name='maxResults'),
  nextToken?: string(name='nextToken'),
}

model ListProductsResponseBody = {
  maxResults?: long(name='maxResults'),
  nextToken?: string(name='nextToken'),
  products?: [ 
    {
      productCode?: string(name='productCode'),
      productName?: string(name='productName'),
    }
  ](name='products'),
  requestId?: string(name='requestId'),
  totalCount?: long(name='totalCount'),
}

model ListProductsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListProductsResponseBody(name='body'),
}

async function listProducts(provider: string, request: ListProductsRequest): ListProductsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listProductsWithOptions(provider, request, headers, runtime);
}

async function listProductsWithOptions(provider: string, request: ListProductsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListProductsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.maxResults)) {
    query['maxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListProducts',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListResourceTypesRequest {
  maxResults?: long(name='maxResults'),
  nextToken?: string(name='nextToken'),
  resourceTypeCodes?: [ string ](name='resourceTypeCodes'),
}

model ListResourceTypesShrinkRequest {
  maxResults?: long(name='maxResults'),
  nextToken?: string(name='nextToken'),
  resourceTypeCodesShrink?: string(name='resourceTypeCodes'),
}

model ListResourceTypesResponseBody = {
  maxResults?: long(name='maxResults'),
  nextToken?: string(name='nextToken'),
  requestId?: string(name='requestId'),
  resourceTypes?: [ 
    {
      createOnlyProperties?: [ string ](name='createOnlyProperties'),
      deleteOnlyProperties?: [ string ](name='deleteOnlyProperties'),
      filterProperties?: [ string ](name='filterProperties'),
      getOnlyProperties?: [ string ](name='getOnlyProperties'),
      getResponseProperties?: [ string ](name='getResponseProperties'),
      handlers?: {
        create?: {
          permissions?: [ string ](name='permissions'),
        }(name='create'),
        delete?: {
          permissions?: [ string ](name='permissions'),
        }(name='delete'),
        get?: {
          permissions?: [ string ](name='permissions'),
        }(name='get'),
        list?: {
          permissions?: [ string ](name='permissions'),
        }(name='list'),
        update?: {
          permissions?: [ string ](name='permissions'),
        }(name='update'),
      }(name='handlers'),
      info?: {
        chargeType?: string(name='chargeType'),
        deliveryScope?: string(name='deliveryScope'),
        description?: string(name='description'),
        title?: string(name='title'),
      }(name='info'),
      listOnlyProperties?: [ string ](name='listOnlyProperties'),
      listResponseProperties?: [ string ](name='listResponseProperties'),
      primaryIdentifier?: string(name='primaryIdentifier'),
      product?: string(name='product'),
      properties?: map[string]any(name='properties'),
      publicProperties?: [ string ](name='publicProperties'),
      readOnlyProperties?: [ string ](name='readOnlyProperties'),
      required?: [ string ](name='required'),
      resourceType?: string(name='resourceType'),
      resourceTypeVersion?: string(name='resourceTypeVersion'),
      sensitiveInfoProperties?: [ string ](name='sensitiveInfoProperties'),
      updateOnlyProperties?: [ string ](name='updateOnlyProperties'),
      updateTypeProperties?: [ string ](name='updateTypeProperties'),
    }
  ](name='resourceTypes'),
  totalCount?: long(name='totalCount'),
}

model ListResourceTypesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListResourceTypesResponseBody(name='body'),
}

async function listResourceTypes(provider: string, productCode: string, request: ListResourceTypesRequest): ListResourceTypesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listResourceTypesWithOptions(provider, productCode, request, headers, runtime);
}

async function listResourceTypesWithOptions(provider: string, productCode: string, tmpReq: ListResourceTypesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListResourceTypesResponse {
  Util.validateModel(tmpReq);
  var request = new ListResourceTypesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.resourceTypeCodes)) {
    request.resourceTypeCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.resourceTypeCodes, 'resourceTypeCodes', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.maxResults)) {
    query['maxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.resourceTypeCodesShrink)) {
    query['resourceTypeCodes'] = request.resourceTypeCodesShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResourceTypes',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model ListResourcesRequest {
  filter?: map[string]any(name='filter'),
  maxResults?: int32(name='maxResults'),
  nextToken?: string(name='nextToken'),
  regionIds?: [ string ](name='regionIds'),
  resourceTypeVersion?: string(name='resourceTypeVersion'),
}

model ListResourcesShrinkRequest {
  filterShrink?: string(name='filter'),
  maxResults?: int32(name='maxResults'),
  nextToken?: string(name='nextToken'),
  regionIdsShrink?: string(name='regionIds'),
  resourceTypeVersion?: string(name='resourceTypeVersion'),
}

model ListResourcesResponseBody = {
  maxResults?: int32(name='maxResults'),
  nextToken?: string(name='nextToken'),
  requestId?: string(name='requestId'),
  resources?: [ 
    {
      regionId?: string(name='regionId'),
      resourceAttributes?: string(name='resourceAttributes'),
      resourceId?: string(name='resourceId'),
    }
  ](name='resources'),
  totalCount?: int32(name='totalCount'),
}

model ListResourcesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListResourcesResponseBody(name='body'),
}

async function listResources(provider: string, productCode: string, resourceTypeCode: string, request: ListResourcesRequest): ListResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listResourcesWithOptions(provider, productCode, resourceTypeCode, request, headers, runtime);
}

async function listResourcesWithOptions(provider: string, productCode: string, resourceTypeCode: string, tmpReq: ListResourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListResourcesResponse {
  Util.validateModel(tmpReq);
  var request = new ListResourcesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'filter', 'json');
  }
  if (!Util.isUnset(tmpReq.regionIds)) {
    request.regionIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.regionIds, 'regionIds', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.filterShrink)) {
    query['filter'] = request.filterShrink;
  }
  if (!Util.isUnset(request.maxResults)) {
    query['maxResults'] = request.maxResults;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['nextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionIdsShrink)) {
    query['regionIds'] = request.regionIdsShrink;
  }
  if (!Util.isUnset(request.resourceTypeVersion)) {
    query['resourceTypeVersion'] = request.resourceTypeVersion;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListResources',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}/resources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

model UpdateResourceRequest {
  body?: string(name='body'),
  clientToken?: string(name='clientToken'),
  regionId?: string(name='regionId'),
}

model UpdateResourceResponseBody = {
  requestId?: string(name='requestId'),
  taskId?: string(name='taskId'),
  timeout?: int32(name='timeout'),
}

model UpdateResourceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateResourceResponseBody(name='body'),
}

async function updateResource(provider: string, productCode: string, resourceTypeCode: string, resourceId: string, request: UpdateResourceRequest): UpdateResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateResourceWithOptions(provider, productCode, resourceTypeCode, resourceId, request, headers, runtime);
}

async function updateResourceWithOptions(provider: string, productCode: string, resourceTypeCode: string, resourceId: string, request: UpdateResourceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateResourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    query['clientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['regionId'] = request.regionId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
    body = request.body,
  };
  var params = new OpenApi.Params{
    action = 'UpdateResource',
    version = '2022-06-06',
    protocol = 'HTTPS',
    pathname = `/api/v1/providers/${OpenApiUtil.getEncodeParam(provider)}/products/${OpenApiUtil.getEncodeParam(productCode)}/resourceTypes/${OpenApiUtil.getEncodeParam(resourceTypeCode)}/resources/${OpenApiUtil.getEncodeParam(resourceId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

